package demoMod.nanaki.cards.nanaki;

import basemod.ReflectionHacks;
import basemod.abstracts.CustomCard;
import com.badlogic.gdx.graphics.Color;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import demoMod.nanaki.patches.AbstractCardEnum;

import java.util.Locale;

public abstract class AbstractNanakiCard extends CustomCard {
    public static final Color textColor = new Color(0x2D1539FF);

    public AbstractNanakiCard(String id, String name, String img, int cost, String rawDescription, CardType type, CardRarity rarity, CardTarget target) {
        super(id, name, img, cost, rawDescription, type, AbstractCardEnum.NANAKI, rarity, target);
        this.isMultiDamage = type == CardType.ATTACK && target == CardTarget.ALL_ENEMY;
        ReflectionHacks.setPrivate(this, AbstractCard.class,"textColor", textColor.cpy());
        ReflectionHacks.setPrivate(this, AbstractCard.class,"goldColor", Color.BLUE.cpy());
    }

    @Override
    public void loadCardImage(String img) {
        img += "_" + this.type.name().toLowerCase(Locale.ROOT) + ".png";
        this.textureImg = img;
        super.loadCardImage(img);
    }

    public abstract Runnable getUpgradeAction();

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.upgradeName();
            getUpgradeAction().run();
        }
    }

    @Override
    public abstract void use(AbstractPlayer p, AbstractMonster m);
}
